import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName;

import javax.lang.model.util.Elements;
import javax.swing.text.Document;
import javax.swing.text.Element;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;

public class test {
    public static void main(String[] args) {
        try {
            URL path = new URL("https://www.scvtc.edu.cn/");
            Document document = Jsoup.parse(path, timeoutMillis:10000);
            System.out.println(document);

            Element elementsByclass = document.getElementsByclass(className:"s1-lpics");
            System.out.println(elementsByclass);
            for (int i = 0; i < elementsByclass.size(); i++) {
                System.out.println("新闻" + i + elementsByclass.get(i));
            }
            for (int i = 0; i < elementsByclass.size(); i++) {
                Elements a = elementsByclass.get(i).getElementsByTag(TagName:"a");
                System.out.println(a);

                for (Element element :
                        a) {

                    System.out.println(element.attr(attributeKey:"title"));
                    System.out.println("新闻地址" + "https://www.scvtc.edu.cn/" + element.attr);
                }
            }

        } catch (java.lang.Exception e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static void getDetail(String p){
        try {
            URL url=new URL(Path) ;
            Document document = Jsoup.parse(path, timeoutMillis:10000);
         //   System.out.println(document);
            Elements v_news_content = document.getRootElementsByClass(className:"v_news_content");
          //  System.out.println(v_news_content );
        for (Element element:
        v_news_content){
            Elements img =element.getElementByTag(TagName:"img");
            for (Element e:
            img){
                System.out.println(e.attr(attributeKey:"src"));
            }
        }


        private static Void downloadInfo(String path){
            try {
                URL url = new URL(path);


            }
            }
        }
    }
}